import 'nprogress/nprogress.css' // progress bar style
import store from '@/store'
import addRoutesByResources from '@/utils/routes-add'
import { getToken } from '@/utils/auth'

function loadMenu(){
  const hasToken = getToken()
  if (hasToken){
    if (store.getters.resources) {
      const resources = store.getters.resources
      addRoutesByResources(resources)
    }
    else {
      this.$store.dispatch('user/getInfo').then(
        () => {
          console.log("我叼尼玛的")
        }
      )
      // if (store.getters.resources) {
      //   // 动态添加路由
      //   // console.log("后端拿到的树",store.getters.resources)
      //   const resources = store.getters.resources
      //   console.log("resources",resources)
      //   // 根据资源列表添加路由
      //   addRoutesByResources(resources)
      // }
    }
  }

}
export default loadMenu;
